<template>
  <div class="xct-apply-container">
    <vm-common-header :pageTitle="pageTitle" :goBack="goBack"></vm-common-header>
    <div class="xct-apply-body-container">
      <div class="xct-apply-main-container">
        <div class="step-wrapper">
          <div class="step-title">
            <i>1</i>
            选择会员级别
          </div>
          <div class="step-content">
            <ul class="xct-level-ul">
              <li :class="[{'active': activeIndex === 1}]" @click="activeIndex = 1">
                <i
                  :class="['xct-icon',{ 'xct-icon-level-1-big': activeIndex === 1, 'xct-icon-level-1': activeIndex !== 1 } ]"
                ></i>
                <p>标准会员</p>
              </li>
              <li :class="[{'active': activeIndex === 2}]" @click="activeIndex = 2">
                <i
                  :class="['xct-icon',{ 'xct-icon-level-2-big': activeIndex === 2, 'xct-icon-level-2': activeIndex !== 2 } ]"
                ></i>
                <p>银牌</p>
              </li>
              <li :class="[{'active': activeIndex === 3}]" @click="activeIndex = 3">
                <i
                  :class="['xct-icon',{ 'xct-icon-level-3-big': activeIndex === 3, 'xct-icon-level-3': activeIndex !== 3 } ]"
                ></i>
                <p>金牌</p>
              </li>
              <li :class="[{'active': activeIndex === 4}]" @click="activeIndex = 4">
                <i
                  :class="['xct-icon',{ 'xct-icon-level-4-big': activeIndex === 4, 'xct-icon-level-4': activeIndex !== 4 } ]"
                ></i>
                <p>金钻</p>
              </li>
              <li :class="[{'active': activeIndex === 5}]" @click="activeIndex = 5">
                <i
                  :class="['xct-icon',{ 'xct-icon-level-5-big': activeIndex === 5, 'xct-icon-level-5': activeIndex !== 5 } ]"
                ></i>
                <p>蓝钻</p>
              </li>
            </ul>
          </div>
        </div>
        <div class="step-wrapper">
          <div class="step-title">
            <i>2</i>
            范本描述
          </div>
          <div class="step-content">
            <div class="document-content">
              <textarea v-model="doc"></textarea>
            </div>
          </div>
        </div>
      </div>
      <div class="btn-container">
        <mt-button type="danger" @click="handleSubmitApply">提交申请</mt-button>
      </div>
    </div>
  </div>
</template>
<script>
import vmCommonHeader from "@/components/vm-common-header.vue";
import doc from "./document.js";
import { Submit_Apply } from "@/api/xincaitong_jicaitong_apply.js";
import { MessageBox } from 'mint-ui';
export default {
  components: {
    "vm-common-header": vmCommonHeader
  },
  data() {
    return {
      activeIndex: 1,
      pageTitle: this.$route.meta.pageTitle,
      goBack: this.$route.meta.goBack,
      doc
    };
  },
  created() {
    console.dir(this);
  },
  methods: {
    handleSubmitApply() {
      Submit_Apply({
        mtype: 0,
        level: this.activeIndex
      })
        .then(res => res.data)
        .then(data => {
          MessageBox.alert(data.message).then(() => {
              if (data.status === 200) {
                  this.$router.back(-1);
              }
          });
        });
    }
  }
};
</script>
<style lang="scss" scoped>
.xct-apply-body-container {
  overflow-y: scroll;
  height: 100%;
}
.xct-icon {
  display: block;
  background: url("../../../static/images/xct-yct-icon.png") no-repeat;
  background-size: 771px 534px;
}

.xct-icon-level-1 {
  width: 70px;
  height: 70px;
  background-position: -70px -54px;
}

.xct-icon-level-1-big {
  width: 96px;
  height: 96px;
  background-position: -58px -276px;
}

.xct-icon-level-2 {
  width: 70px;
  height: 70px;
  background-position: -188px -54px;
}

.xct-icon-level-2-big {
  width: 96px;
  height: 96px;
  background-position: -174px -276px;
}

.xct-icon-level-3 {
  width: 70px;
  height: 70px;
  background-position: -317px -54px;
}

.xct-icon-level-3-big {
  width: 96px;
  height: 96px;
  background-position: -317px -276px;
}

.xct-icon-level-4 {
  width: 70px;
  height: 70px;
  background-position: -446px -54px;
}

.xct-icon-level-4-big {
  width: 96px;
  height: 96px;
  background-position: -446px -276px;
}

.xct-icon-level-5 {
  width: 70px;
  height: 70px;
  background-position: -575px -54px;
}

.xct-icon-level-5-big {
  width: 96px;
  height: 96px;
  background-position: -589px -276px;
}

.xct-apply-body-container {
  overflow-y: scroll;
}

.xct-apply-main-container {
  padding: 0px 20px;
  background-color: #fff;
}

.step-wrapper {
  padding: 50px 0px;
  border-bottom: 1px solid #eee;

  &:last-of-type {
    border: 0;
  }

  .step-title {
    padding-left: 80px;
    position: relative;
    text-align: left;
    color: #333;
    font-size: 32px;
    i {
      display: block;
      width: 40px;
      height: 40px;
      background-color: #f34b50;
      text-align: center;
      color: #fff;
      border-radius: 50%;
      position: absolute;
      left: 20px;
      top: 50%;
      transform: translateY(-50%);
      line-height: 40px;
    }
  }
}

.xct-level-ul {
  display: flex;
  align-items: center;
  margin-top: 40px;
  li {
    height: 150px;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    position: relative;
    box-sizing: border-box;
    padding-bottom: 30px;

    p {
      position: absolute;
      bottom: 0;
      color: #999;
      font-size: 28px;
    }

    &.active {
      p {
        color: #333;
      }
    }
  }
}

.btn-container {
  background: #ffffff;
  border-top: 1px solid #eeeeee; /* no */
  width: 100%;
  height: 120px;
  border-top: 1px solid #eee; /* no */
  display: flex;
  justify-content: center;
  box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.11);
  margin-top: 16px;
  button {
    width: 220px;
    height: 80px;
    margin: 21px 20px 12px 30px;
    border-radius: 10px; /* no */
    font-size: 28px;
    background-color: #f34b50;
    color: #fff;
    font-size: 24px;
  }
}

.document-content {
  height: 1247px;
  margin-top: 30px;
  border: 1px solid #999;
  padding: 40px 30px;
  textarea {
    width: 100%;
    height: 100%;
    font-size: 28px;
    line-height: 50px;
    color: #666;
    overflow-x: hidden;
  }
}
</style>
